package com.example.demo08;

import java.util.List;

import android.app.Application;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.support.v4.app.e;
import dalvik.system.DexClassLoader;

public class InitApplication extends Application {
	

	void a() {
//		System.out.println("check ret=" + check("/mnt/sdcard/core.jar"));
		
		DexClassLoader dcl = new DexClassLoader("/mnt/sdcard/core.jar", getDir("oo", 0).getPath(), null, getClassLoader());
		
		ClassLoader cl1 = dcl;
		ClassLoader cl2 = getClassLoader();
		
		System.out.println("c1p=" + cl1.getParent());
		System.out.println("c2p=" + cl2.getParent());
		
//		nice(cl1, cl2); //

		System.out.println("c1p=" + cl1.getParent());
		System.out.println("c2p=" + cl2.getParent());
	}
	
	void b() {
//		System.out.println("boot ret=" + boot());
		System.out.println(e.check("/mnt/sdcard/test.apk"));
		System.out.println("data=" + e.getData());
	}
	
	void c() {
		List<ResolveInfo> list = getPackageManager().queryIntentActivities(
    			new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setPackage(getPackageName()), 
    			0);
    	
    	if(list != null && !list.isEmpty()) {
    		String proc = list.get(0).activityInfo.processName;
    		System.err.println("UI process=" + proc);
    		
    		for(ResolveInfo info : list)
    			System.out.println(info);
    	}
	}
	
	@Override
	public void onCreate() {
		super.onCreate();

		System.loadLibrary("boot");
//		e.load();
	}
}
